<template>
  <div ref="Fdom">父组件</div>
  <div>===========</div>
  <oneCom ref="Sdom"></oneCom>
  <div>===========</div>
  <p>moment格式化时间</p>
  <h3>{{ format(now,'YYYY-MM-DD HH:mm:ss') }}</h3>
  <h3>{{ format(now,'YYYY-MM-DD') }}</h3>
  <p>dayjs格式化时间</p>
  <h3>{{ format2(now,'YYYY-MM-DD HH:mm:ss') }}</h3>
  <h3>{{ format2(now,'YYYY-MM-DD') }}</h3>
</template>

<script setup>
import oneCom from './components/oneCom.vue'
import {ref,provide,onMounted} from 'vue'
import moment from 'moment'
import dayjs from 'dayjs'
const articelId =ref('123123123')
provide('articelId',articelId)

const Fdom = ref()
const Sdom = ref()

// console.log 这里的打印能够看到dom的值,时console.log的问题,因为我们展开对象的时候
// log这个函数去获取了最新的值,
onMounted(()=>{
  console.log(Fdom.value);
  console.log(Sdom.value);

})
console.log(moment);
const now = new Date()
const format = (now,formatParam)=> moment(now).format(formatParam)

const format2 = (now,formatParam)=> dayjs(now).format(formatParam)
/* const dayjs = require('dayjs')
dayjs().format() */
</script>